// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

using SixLabors.ImageSharp.Processing.Processors.Filters;

namespace SixLabors.ImageSharp.Processing;

/// <summary>
/// Defines extensions that allow the recreation of an old Polaroid camera effect on an <see cref="Image"/>
/// using Mutate/Clone.
/// </summary>
public static class PolaroidExtensions
{
    /// <summary>
    /// Alters the colors of the image recreating an old Polaroid camera effect.
    /// </summary>
    /// <param name="source">The current image processing context.</param>
    /// <returns>The <see cref="IImageProcessingContext"/>.</returns>
    public static IImageProcessingContext Polaroid(this IImageProcessingContext source)
        => source.ApplyProcessor(new PolaroidProcessor(source.GetGraphicsOptions()));

    /// <summary>
    /// Alters the colors of the image recreating an old Polaroid camera effect.
    /// </summary>
    /// <param name="source">The current image processing context.</param>
    /// <param name="rectangle">
    /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
    /// </param>
    /// <returns>The <see cref="IImageProcessingContext"/>.</returns>
    public static IImageProcessingContext Polaroid(this IImageProcessingContext source, Rectangle rectangle)
        => source.ApplyProcessor(new PolaroidProcessor(source.GetGraphicsOptions()), rectangle);
}
